package com.itheima.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.SmsFlashPromotion;
import com.itheima.mapper.SmsFlashPromotionMapper;
import com.itheima.service.SmsFlashPromotionService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 限时购表 服务实现类
 * </p>
 *
 * @author zhuguo
 * @since 2022-11-10
 */
@DubboService
public class SmsFlashPromotionServiceImpl extends ServiceImpl<SmsFlashPromotionMapper, SmsFlashPromotion> implements SmsFlashPromotionService {
    @Autowired
    SmsFlashPromotionMapper smsFlashPromotionMapper;

    @Override
    public Page page(String title, Integer pageNum, Integer pageSize) {
        Page<SmsFlashPromotion> page = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<SmsFlashPromotion> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(StrUtil.isNotBlank(title),SmsFlashPromotion::getTitle,title);
        smsFlashPromotionMapper.selectPage(page,queryWrapper);
        return page;
    }
}
